<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
    <base href="<%=basePath%>">
    <title>优标检测网</title>
    <!-- 浏览器上显示title 图标 icon图标 -->
	<link type="image/x-icon" rel="icon" href="<%=basePath %>resource/img/minilogo.png">

	<!-- 如果想让图标出现在收藏夹中，就：  -->
	<link type="image/x-icon" rel="shortcut icon" href="<%=basePath %>resource/img/minilogo.png">
	<link type="image/x-icon" rel="bookmark" href="<%=basePath %>resource/img/minilogo.png">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="优标">
	<meta http-equiv="description" content="优标">
    <link href="<%=basePath %>portal/css/page.css" type="text/css" rel="stylesheet">
    <link href="<%=basePath %>portal/css/main.css" type="text/css" rel="stylesheet">
    <title>个人中心</title>
	<style>
		#reportList a,#reportList a:hover{color: #555454;}
		.PCStandardName2 {
			width: 140px;
		}
		.PCStandardStatus2 {
		    width: 170px;
		}
		.PCStandardText2 {
			width: 140px;
		}
		.PCStandardType2 {
			width: 170px;
		}
		.PCStandardTime2 {
		    width: 70px;
		}
		.PCQrCodeBig{top:-41px}
		.PCQRCode2{margin-top:-6px;}
	</style>
</head>
<body>
<%@include file="p_head.jsp"%>
<div class="NCContent">
    <div class="NCNewsHead">
        <div class="MainPage">
            <div class="NCMain">
                <h2 class="NCHeadWord">个人中心 / Personal Center </h2>
            </div>
        </div>
    </div>
    <div class="NCNewsList">
        <div class="MainPage">
            <div class="NCMain">
                <div class="NCNewsListContent">
                    <div class="PCContentHead2"></div>
                    <div class="PCContentBody1">
                        <%@include file="p_left.jsp"%>
                        <div class="PCContentMain2">
                            <div class="PCPerInfoContent">
                                <div class="PCUserTop">
                                    <div class="PCUserSearchBoxLast">
                                        <span class="PCUserSearchTextLast">报告编号</span><input
                                            class="PCUserSearchTextLast" type="text" id="s_reportNumber" value="${s_reportNumber}"/><span
                                            class="PCUserSearchTextLast">样品名称</span>
											<input class="PCUserSearchTextLast"  value="${s_sampleName}" type="text" id="s_sampleName"/><span
                                            class="BtnCss PCUserSearchBtn2">搜索</span>
											<c:if test="${account.accountType==2}">
											<span class="BtnCss PCLastBtn">上传检测报告</span>
											</c:if>
                                    </div>
                                </div>
                                <div class="PCPerQCBox3">
                                    <div class="PCPerQCBoxGroup2">
                                        <div class="PCStandardTitle PCStandardNum2" style="display:none">序号</div>
                                        <div class="PCStandardTitle PCStandardName2">报告编号</div>
                                        <div class="PCStandardTitle PCStandardType2">样品名称</div>
                                        <div class="PCStandardTitle PCStandardText2">生产日期批号</div>
                                        <c:if test="${account.accountType==1}">
                                        <div class="PCStandardTitle PCStandardStatus2">检验机构</div>
                                        </c:if>
                                        <c:if test="${account.accountType==2}">
                                        <div class="PCStandardTitle PCStandardStatus2">企业名称</div>
                                        </c:if>
                                        <div class="PCStandardTitle PCStandardTime2">上传日期</div>
                                    </div>
                                    <div id="reportList"></div>
                                </div>
                                <div class="news_content" id="page"></div>
                            </div>

                            <div style="clear:both"></div>
                        </div>

                    </div>
                    <div class="PCContentFoot2"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" name="pageSize" id="pageSize" value="${pageSize}"/>
<input type="hidden" name="pageCount" id="pageCount" value="${pagecount}"/>
<input type="hidden" name="basePath" id="basePath" value="<%=basePath%>"/>
<%@include file="p_foot.jsp"%>
</body>
<script src="<%=basePath %>portal/js/res/jquery-1.4.2.min.js"></script>
<script src="<%=basePath %>portal/js/res/jquery.myPagination.js"></script>
<script src="<%=basePath %>portal/js/res/responsiveslides.min.js"></script>
<script src="<%=basePath %>portal/js/page/base.js"></script>
<script src="<%=basePath %>portal/js/res/jquery.qrcode.min.js"></script> 
<script>
$(function(){
	$("#page").myPagination({
	    currPage: 1,
	    pageCount: Number($("#pageCount").val()),
	    pageSize: Number($("#pageSize").val()) ,
	    cssStyle: 'sabrosus',
	    info: {
	        first: '首页',
	        first_on: true,
	        last: '尾页',
	        last_on: true,
	        prev: '&lt',
	        prev_on: true,
	        next: '&gt',
	        next_on: true,
	        //msg_on:false,		//为false 可以关闭 跳转栏
	        //link: '',
	        msg: "<div class='pagenum'><br><br>共{sum}页&nbsp;&nbsp;&nbsp;&nbsp;到第&nbsp;{curr}&nbsp;页</div>",
	    },
		ajax: {  
		    on: true,                         //开启状态
		    callback: 'ajaxCallBack',         //回调函数，注，此 ajaxCallBack 函数，必须定义在 $(function() {}); 外面  
		    url: $("#basePath").val()+"report_getReportJson.action",            //访问服务器地址  
		    dataType: 'json',                 //返回类型  
		    param:{on:true,page:1,rows:10,s_reportNumber:$("#s_reportNumber").val(),s_sampleName:encodeURI(encodeURI($("#s_sampleName").val()))} //参数列表，其中  on 必须开启，page 参数必须存在，其他的都是自定义参数，如果是多条件查询，可以序列化表单，然后增加 page 参数  
		}
	});
	$("#reportList").html("<div style='text-align:center;padding-top:140px;'>正在获取数据...</div>");
});

//自定义 回调函数  
function ajaxCallBack(data) { 
     var result = data.rows;  
     var insetViewData = ""; //视图数据  
     $.each(result, function(index,items) {  
    	 //alert(items.id);  
    	 insetViewData += createStandards(items);  
     });  
	 if (insetViewData == "")
	 {
		 insetViewData = "<div style='text-align:center;padding-top:140px;'>没有检索到数据</div>";
	 }
     $("#reportList").html(insetViewData);
     $('.qrcode').each(function() {
		$(this).qrcode({ 
			render: "table", //table方式 
			width: 100, //宽度 
			height:100, //高度 
			text: $(this).attr("url") //任意内容 
		});
	 });

	 /*$(".PCQRCode2").hover(function() {
		$(this).find(".qrcode:first-child").each(function() {
			$(this).qrcode({ 
				render: "table", //table方式 
				width: 100, //宽度 
				height:100, //高度 
				text: $(this).attr("url") //任意内容 
			});
		 });
	});*/
}  

function createStandards(obj){
	var standard = '<a href="'+obj.filePath+'" target="_blank">'
						+'<div class="PCPerQCBoxGroup2">'
						+'<div class="PCStandardTitle2 PCStandardNum2" style="display:none">'+obj.reportId+'</div>'
						+'<div class="PCStandardTitle2 PCStandardName2">'+obj.reportNumber+'</div>'
						+'<div class="PCStandardTitle2 PCStandardType2">'+obj.sampleName+'</div>'
						+'<div class="PCStandardTitle2 PCStandardText2">'+obj.scrqph+'</div>'
						+'<div class="PCStandardTitle2 PCStandardStatus2">'+obj.shangchuanCompName+'</div>'
						+'<div class="PCStandardTitle2 PCStandardTime2">'+obj.addTime+'</div>'
							+'<span href="#" class="PCStandardTitle2 PCQRCode2">'
								+'<div class="qrcode PCQrCodeBig" url="'+$("#basePath").val() + obj.filePath.substr(0)+'" style="margin-left: 100px;"></div>'
							+'</span>'
					+'</div></a>'; 
	return standard;  
}

$(".PCUserSearchBtn2").click(function(){
	url = $("#basePath").val() + "report_index.action?s_reportNumber=" 
		+ $("#s_reportNumber").val() + "&s_sampleName=" + $("#s_sampleName").val();
	url = encodeURI(encodeURI(url));
    location.href = url;
})

$(".PCLastBtn").click(function(){
    location.href = $("#basePath").val() + "report_showUpload.action";
})

</script>
</html>